package cn.com.blueInfo.bpm.template.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 实例状态
 * @author suxch
 * @since 2025/8/28 22:43
 */
@Getter
@AllArgsConstructor
public enum InstanceProcessStatus implements BaseEnum<String> {

    /** 实例状态-草稿 */
    DRAFT("DRAFT", "草稿"),
    /** 实例状态-运行中 */
    RUNNING("RUNNING", "运行中"),
    /** 实例状态-已完成 */
    COMPLETED("COMPLETED", "已完成"),
    /** 实例状态-已取消 */
    CANCELED("CANCELED", "已取消");

    @EnumValue
    private final String code;

    @JsonValue
    private final String desc;

    public static InstanceProcessStatus getByCode(String code) {
        return BaseEnum.getByCode(InstanceProcessStatus.class, code);
    }

    @JsonCreator
    public static InstanceProcessStatus getByName(String name) {
        return BaseEnum.getByName(name, InstanceProcessStatus.class);
    }

}
